package logic

import (
	"context"
	"shop_srv/model/redis"

	"shop_srv/internal/svc"
	"shop_srv/shop"

	"github.com/zeromicro/go-zero/core/logx"
)

type DelCartLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDelCartLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelCartLogic {
	return &DelCartLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DelCartLogic) DelCart(in *shop.DelCartRequest) (*shop.DelCartResponse, error) {
	// todo: add your logic here and delete this line
	err := redis.DelCart(in.UserId, in.GoodsId)
	if err != nil {
		return nil, err
	}
	return &shop.DelCartResponse{Success: true}, nil
}
